<?php

namespace App\Livewire;

use App\Models\Book;
use Livewire\Attributes\Url;
use Livewire\Component;
use Livewire\WithPagination;

class SearchList extends Component
{
    use WithPagination;

    #[Url]
    public string $keyword = '';

    public function mount()
    {

    }

    public function search()
    {
        $this->resetPage();
    }

    public function render()
    {
        return view('livewire.search-list',[
            'books'=>Book::where('title','like',"%{$this->keyword}%")->where('status',1)->paginate(16),
        ]);
    }
}
